import { View } from "@tarojs/components";
import { Popup as NutPopup } from "@nutui/nutui-react-taro";
import React from "react";
import './index.less'

interface Props {
	title: string
	visible: boolean
	onClose: () => any
	onConfirm: () => any
}
const Popup = (props: Props & React.PropsWithChildren) => {
	const { title, visible, onClose, onConfirm, children } = props
	return (
		<NutPopup
			visible={visible}
			onClose={onClose}
			style={{ height: "80vh" }}
			position="bottom"
			className="popup-container"
		>
			<View className="head-wrap">
				<View className="cancel" onTap={onClose}>
					取消
				</View>
				<View className="title font-bold">{title}</View>
				<View className="confirm" onTap={onConfirm}>
					确定
				</View>
			</View>
			{children}
		</NutPopup>
	)
}

export default Popup;